package com.gitee.deament.server.core.cli;

import com.gitee.deament.server.config.SystemConfig;
import com.gitee.deament.server.core.annotation.CliHander;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.http.websocketx.TextWebSocketFrame;


import java.util.Date;
@CliHander(command="TIME")
public class TIMEcli extends AbstractCli{
    @Override
    public void executeCli(ChannelHandlerContext channelHandlerContext, String command) {
        Date now = new Date();
        channelHandlerContext.channel().writeAndFlush("\""+new TextWebSocketFrame(SystemConfig.startDateTime.getTime()+"\""));
        channelHandlerContext.channel().writeAndFlush("\""+new TextWebSocketFrame((now.getTime()-SystemConfig.startDateTime.getTime())+"\""));
    }
}
